04. Overriding Same Origin Policy
Overriding Same Origin Policy
INSTRUCTOR NOTE:
Message passing
Another technique that was explicitly designed to allow cross-origin communication is called message passing. postMessage()
is a function that can be called to pass a message to other windows and iframes, even if they come from a different origin. This creates a message event you subscribe to like any other event. For security, the receiver can inspect the message’s origin and content.
While postMessage is much cleaner and allows more granular control than the other cross-origin options, it sadly hasn’t been as widely adopted by API providers.
Instructor Notes
Message passing
Another technique that was explicitly designed to allow cross-origin communication is called message passing. postMessage()
is a function that can be called to pass a message to other windows and iframes, even if they come from a different origin. This creates a message event you subscribe to like any other event. For security, the receiver can inspect the message’s origin and content.
While postMessage is much cleaner and allows more granular control than the other cross-origin options, it sadly hasn’t been as widely adopted by API providers.